package com.itheima.controller;

import com.itheima.common.constant.MessageConstant;
import com.itheima.common.entity.Result;
import com.itheima.dto.LoginDto;
import com.itheima.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/member")
public class memberController {
    @Autowired
    private RedisTemplate redisTemplate;
    @Autowired
    private MemberService memberService;

    /**
     * 用手机登录
     */
    @PostMapping("/login")
    public Result login(@RequestBody LoginDto loginDto){
     String temp =  memberService.login(loginDto);
     if(temp == MessageConstant.LOGIN_SUCCESS){
         return new Result(true,temp);
     }else
         return new Result(false,temp);

    }
}
